import Vue from 'vue';
import Router from 'vue-router';
import HelloWorld from '@/components/HelloWorld';
import index from '../components/index';

Vue.use(Router)
import Login from '../components/login';
import Register from '../components/register';
import Generalization from '../components/generalization';
import Person from '../components/person';


import Customer from '../components/customer';
import CusYixiang from '../components/cusYixiang';
import CusBaojian from '../components/cusBaojian';
import userApplydetial from '../components/userApplydetial';
import userApply from '../components/userApply';
import userEntry from '../components/userEntry';
import userRegister from '../components/userRegister';

import identityperson from '../components/identityperson';
import success from '../components/success';

export default new Router({
    routes: [{
            path: '/',
            name: 'login',
            component: Login,
            meta: {
                title: '业务员登录'
            }
        },
        {
            path: '/identityperson',
            component: identityperson,
            meta: {
                title: '客户预审'
            }
        },
        {
            path: '/success',
            component: success,
            meta: {
                title: '申请成功'
            }
        },
        {
            path: '/index',
            component: index,
            meta: {
                title: '业务员系统'
            }
        },
        {
            path: '/login',
            component: Login,
            meta: {
                title: '业务员系统'
            }
        },
        {
            path: '/register',
            component: Register,
            meta: {
                title: '注册'
            }
        },
        {
            path: '/generalization',
            component: Generalization,
            meta: {
                title: '扫码推广'
            }
        },
        {
            path: '/person',
            component: Person,
            meta: {
                title: '个人中心'
            }
        },
        {
            path: '/userApply',
            component: userApply,
            meta: {
                title: '申请用户'
            }
        },
        {
            path: '/userRegister',
            component: userRegister,
            meta: {
                title: '注册用户'
            }
        },
        {
            path: '/customer',
            component: Customer,
            meta: {
                title: '我的客户'
            }
        },
        {
            path: '/userEntry',
            component: userEntry,
            meta: {
                title: '客户录入'
            }
        },
        {
            path: '/cusYixiang',
            component: CusYixiang,
            meta: {
                title: '意向客户'
            }
        },
        {
            path: '/cusBaojian',
            component: CusBaojian,
            meta: {
                title: '报件客户'
            }
        },
        {
            path: '/userApplydetial',
            component: userApplydetial,
            meta: {
                title: '申请用户详情'
            }
        }
    ]

})
Router.prototype.go = function (a) {
    sessionStorage.isBack = true
    if (a) {
        window.history.go(a)
    } else {
        window.history.go(-1)
    }
    console.log(a)
}


window.addEventListener("popstate", function (e) {
    sessionStorage.isBack = true
}, false);
